﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Move : MonoBehaviour
{

    float time;
    float moveDis = 5;
    // Start is called before the first frame update
    void Start()
    {
        moveDis = Random.Range(5, 10);
        time = moveDis;
    }

    // Update is called once per frame
    void Update()
    {
        time -= Time.deltaTime;
        if (time <= 0)
        {
            time = moveDis;
            transform.localRotation = Quaternion.Euler(0, 180, 0) * transform.localRotation;
        }
        transform.Translate(transform.right * Time.deltaTime * 3f, Space.World);
    }
}
